// Copyright 2011 Google Inc.  All Rights Reserved.

(function(a){function o(){a(".floor a").click(function(f){var c=(f.target.href||"").split("#");c&&c[1]&&(l.setPod(c[1]),(c=a("#developers-questions").offset())&&a(m()).animate({scrollTop:c.top},400));f.preventDefault()});a("#floor-nav a").click(function(f){var c;if(this.className!="on")a("#floor-nav .on").removeClass("on"),this.className="on",c=document.getElementById(f.target.href.split("#")[1]),a("#floors").animate({top:-c.offsetTop});f.preventDefault()})}var d=d||this;a(document.documentElement).addClass("js");
var m=function(){for(var a=["documentElement","body"],c=null,d,b=0;b<a.length;++b)if(d=document[a[b]].scrollTop,document[a[b]].scrollTop+=1,document[a[b]].scrollTop===d+1){c=a[b];break}c&&(m=function(){return document[c]});return document[c]},l=function(){function f(b){var h=b.target,n=(h.href||"").split("#");n.length&&n[1]!=c&&(c=n[1],a("#current-pod span").text(a(h).text()),d.hide().filter("#"+c).show());b.preventDefault()}var c="all",d=a(".pod"),b=function(){function c(a){a.stopPropagation()}function h(){b&&
(b.hide().css({top:"",bottom:""}),b.closest(".company").removeClass("on"),a(document).unbind("click",h),a(b).unbind("click",c),b.find(".close").unbind("click",h),b=null);return false}var b=null;a(".pod").click(function(g){var e,f,d,i,k,j;(g=a(g.target).closest(".company"))&&g.length&&!g.hasClass("on")?(h(),g.addClass("on"),e=g.find(".info"),f=e.children(".caret"),e.css({display:"block",visibility:"hidden"}),d=e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom")),i=g.position(),
k=g.offset(),j=a(g.get(0).offsetParent),i.top+20-d<0||k.top+20-d-(document.documentElement.scrollTop||document.body.scrollTop)<0?(e.css({top:i.top+95+"px",visibility:"visible",display:"none"}),f.get(0).className="caret bottom"):(e.css({bottom:j.height()-i.top+"px",visibility:"visible",display:"none"}),f.get(0).className="caret top"),d=e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("padding-right")),d=j.width()-d,k=g.width()/2+parseInt(g.css("margin-left")),e.css("left",d*((i.left+k)/j.width())+
"px"),f.css({left:(i.left+65)/j.width()*100+"%"}),e.fadeIn(250),g.find(".close").click(h),b=e,b.click(c),a(document).click(h)):h();return false});a("#pod-filters a").click(f)};b.setPod=function(b){a("#pod-filters a."+b).click()};b.showDescription=function(b){var c=a("#"+b);c&&c.length&&a(m()).animate({scrollTop:c.offset().top-30},400,function(){c.click()})};return b}();a(document).ready(function(){o();l();if(d.location.hash&&d.location.hash.length){var a=escape(d.location.hash.split("#")[1]);l.showDescription(a)}})})(jQuery);